<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>色彩主题背景切换器</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            background-size: cover;
            background-attachment: fixed;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            transition: background 1s ease;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            position: relative;
            color: #fff;
        }

        .container {
            max-width: 1200px;
            width: 100%;
            text-align: center;
            z-index: 1;
        }

        h1 {
            font-size: 2.8rem;
            margin-bottom: 20px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            color: #fff;
            background: linear-gradient(to right, #ff9a9e, #fad0c4);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .description {
            font-size: 1.2rem;
            margin-bottom: 40px;
            max-width: 700px;
            margin-left: auto;
            margin-right: auto;
            line-height: 1.6;
            color: #e6e6e6;
        }

        .nav {
            display: flex;
            justify-content: center;
            gap: 20px;
            width: 100%;
            max-width: 900px;
            margin: 0 auto;
            padding: 25px;
            background: linear-gradient(145deg, #4568dc, #b06ab3);
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        img {
            width: 200px;
            height: 250px;
            object-fit: cover;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.4s ease;
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
            border: 2px solid rgba(255, 255, 255, 0.3);
        }

        img:hover {
            transform: scale(1.08) translateY(-8px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
            border-color: rgba(255, 255, 255, 0.6);
        }

        .current-bg {
            margin-top: 40px;
            font-size: 1.1rem;
            padding: 12px 24px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            display: inline-block;
            backdrop-filter: blur(5px);
        }

        .footer {
            margin-top: 50px;
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.8);
        }

        .color-themes {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 30px;
            flex-wrap: wrap;
        }

        .color-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s ease;
        }

        .color-btn:hover {
            transform: scale(1.1);
        }

        /* 响应式设计 */
        @media (max-width: 900px) {
            .nav {
                flex-wrap: wrap;
                max-width: 600px;
            }
            
            img {
                width: 160px;
                height: 200px;
            }
        }

        @media (max-width: 600px) {
            h1 {
                font-size: 2.2rem;
            }
            
            .description {
                font-size: 1rem;
            }
            
            img {
                width: 130px;
                height: 160px;
            }
            
            .nav {
                gap: 12px;
                padding: 15px;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>色彩主题背景切换器</h1>
        <p class="description">点击下方任意图片，即可将整个页面背景切换为不同颜色主题。享受个性化色彩体验！</p>
        
        <div class="nav">
            
            
            
            
        </div>
        
        <div class="current-bg">当前背景：蓝紫色渐变</div>
        
        <div class="color-themes">
            <div class="color-btn" style="background: linear-gradient(135deg, #6a11cb, #2575fc);" title="蓝紫色主题"></div>
            <div class="color-btn" style="background: linear-gradient(135deg, #ff9a9e, #fad0c4);" title="粉色主题"></div>
            <div class="color-btn" style="background: linear-gradient(135deg, #00cdac, #02aab0);" title="青绿色主题"></div>
            <div class="color-btn" style="background: linear-gradient(135deg, #de6161, #2657eb);" title="红蓝色主题"></div>
            <div class="color-btn" style="background: linear-gradient(135deg, #f7971e, #ffd200);" title="橙黄色主题"></div>
        </div>
        
        <div class="footer">
            <p>纯CSS和JavaScript实现 | 背景切换效果 | 颜色主题</p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            var images = document.querySelector('.nav').querySelectorAll('img');
            var colorButtons = document.querySelectorAll('.color-btn');
            var currentBg = document.querySelector('.current-bg');
            var bgDescriptions = [
                "自然风景",
                "城市建筑",
                "山脉",
                "海滩"
            ];
            
            // 图片点击事件
            for (var i = 0; i < images.length; i++) {
                images[i].addEventListener('click', function() {
                    // 获取图片的主色调（简化处理）
                    var index = Array.from(images).indexOf(this);
                    changeBackground(index);
                    
                    // 更新当前背景描述
                    currentBg.textContent = "当前背景：" + bgDescriptions[index];
                });
            }
            
            // 颜色按钮点击事件
            colorButtons.forEach(function(btn, index) {
                btn.addEventListener('click', function() {
                    var style = window.getComputedStyle(btn);
                    var backgroundImage = style.backgroundImage;
                    document.body.style.backgroundImage = backgroundImage;
                    currentBg.textContent = "当前背景：自定义颜色主题 " + (index + 1);
                });
            });
            
            // 根据图片索引改变背景
            function changeBackground(index) {
                var gradients = [
                    'linear-gradient(135deg, #6a11cb 0%, #2575fc 100%)', // 蓝紫色
                    'linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%)', // 粉色
                    'linear-gradient(135deg, #00cdac 0%, #02aab0 100%)', // 青绿色
                    'linear-gradient(135deg, #de6161 0%, #2657eb 100%)'  // 红蓝色
                ];
                
                document.body.style.backgroundImage = gradients[index];
            }
        });
    </script>
</body>
</html>